package com.objecteffects.template.web.utils;

import java.util.Collection;
import java.util.Locale;

import javax.inject.Inject;

import net.sourceforge.stripes.validation.TypeConverter;
import net.sourceforge.stripes.validation.ValidationError;

/**
 * @author Rusty Wright
 */
public class PasswordTypeConverter implements TypeConverter<String> {
    @Inject
    private TemplateHasher templateHasher;

    @Override
    public String convert(final String input,
        final Class<? extends String> targetType,
        final Collection<ValidationError> errors) {
        return this.templateHasher.hash(input);
    }

    @Override
    public void setLocale(final Locale locale) {
        //
    }
}
